package org.cnbi.utils.pojo.dash;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
/**
 * 对象预测模型xml文件
 * @author 龚佳新
 *
 */
public class ModelBean {
	
	private String id;
	
	private String title;
	
	/**
	 * 数据类型
	 */
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	private String  dataType="random";
	
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	private String factType;//是否为统一度量的查询 
	
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	private String subject;
	
	
	
	
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	private String datas;
	
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
    public List<Object> slider;
    @JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public List<Object> progress;
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public List<Object> chart;
	
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public List<Object> items;
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public Map<Object ,List<Object>> industry;
	
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public Map<Object ,List<Object>> assistItems;
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public Map<String ,Object> toolsMap;
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public Map<Object ,List<Object>> formula;
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
	public String repalceVar;
	
	@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
    public List<Object> tips;
	
	
	/**
	 * @return the datas
	 */
	public String getDatas() {
		return datas;
	}


	/**
	 * @param datas the datas to set
	 */
	public void setDatas(String datas) {
		this.datas = datas;
	}
	
	
	public ModelBean(){}
	
	 
	public ModelBean(String id, String title) {
		super();
		this.id = id;
		this.title = title;
   }

	
	
	
	 
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	

	

	public Map<Object, List<Object>> getAssistItems() {
		return assistItems;
	}

	public void setAssistItems(Map<Object, List<Object>> assistItems) {
		this.assistItems = assistItems;
	}

	

	
	
	


	public Map<String, Object> getToolsMap() {
		return toolsMap;
	}
	public void setToolsMap(Map<String, Object> toolsMap) {
		this.toolsMap = toolsMap;
	}
	
	
	public Map<Object, List<Object>> getIndustry() {
		return industry;
	}


	public void setIndustry(Map<Object, List<Object>> industry) {
		this.industry = industry;
	}


	/*@Override
	public String toString() {
		return JsonUtil.object2json(this);
	}*/
	@JsonIgnore
	public void operateItem(List<Object> items,StringBuffer indexSf){
		for (int i = 0; i < items.size(); i++) {
			ItemBean bean =(ItemBean)items.get(i);
			String scode = bean.getScode();
			if(scode.contains("_")){
				//scode = scode.split("_")[1];
				//if(null==repalceVar) 
			  }
			     indexSf.append(scode);
			if(i!=items.size()-1){
				indexSf.append(",");
			}
		}
	}
	@JsonIgnore
	public String getSliderItemScode(){
		StringBuffer indexSf = new StringBuffer();
		operateItem(items, indexSf);
		return indexSf.toString();
	}
	/*@JsonIgnore
	public String getQueryItemScode(){
		StringBuffer indexSf = new StringBuffer();
		operateItem(items, indexSf);
		if(null!=assistItems && assistItems.size()>0){
			List<Object> assistList= assistItems.get(Constants.ASSISTS_ITEMS);
			if(null!=assistList){
				indexSf.append(",");
				operateItem(assistList, indexSf);
			}
			List<Object> qcItemsList= assistItems.get(Constants.QC_ITEMS);
			if(null!=qcItemsList){
				indexSf.append(";");
				operateItem(qcItemsList, indexSf);
			}
			List<Object> bjqItemsList= assistItems.get(Constants.BJQ_ITEMS);
			if(null!=bjqItemsList){
				indexSf.append(";");
				operateItem(bjqItemsList, indexSf);
			}
		}
		return indexSf.toString();
		
	}*/
	
	
	/**
	 * 
	 */
	private void operateObject(List<Object> res,List<Object> des) {
		
		if(null != res)
		for (Object object : res) {
			des.add(object);
		}

	}
	@JsonIgnore
	public List<Object> getQueryItems(){
		List<Object> list = new ArrayList<Object>();
		operateObject(items, list);
		if(null!=assistItems && assistItems.size()>0){
			List<Object> assistList= assistItems.get(Constants.ASSISTS_ITEMS);
			if(null!=assistList){
				operateObject(assistList, list);
			}
			List<Object> qcItemsList= assistItems.get(Constants.QC_ITEMS);
			if(null!=qcItemsList){
				operateObject(qcItemsList, list);
			}
			List<Object> bjqItemsList= assistItems.get(Constants.BJQ_ITEMS);
			if(null!=bjqItemsList){
				operateObject(bjqItemsList, list);
			}
		}
		return list;
		
	}


	public String getRepalceVar() {
		return repalceVar;
	}


	public void setRepalceVar(String repalceVar) {
		this.repalceVar = repalceVar;
	}


	/**
	 * @return the slider
	 */
	public List<Object> getSlider() {
		return slider;
	}


	/**
	 * @param slider the slider to set
	 */
	public void setSlider(List<Object> slider) {
		this.slider = slider;
	}


	/**
	 * @return the progress
	 */
	public List<Object> getProgress() {
		return progress;
	}


	/**
	 * @param progress the progress to set
	 */
	public void setProgress(List<Object> progress) {
		this.progress = progress;
	}


	/**
	 * @return the chart
	 */
	public List<Object> getChart() {
		return chart;
	}


	/**
	 * @param chart the chart to set
	 */
	public void setChart(List<Object> chart) {
		this.chart = chart;
	}


	/**
	 * @return the items
	 */
	public List<Object> getItems() {
		return items;
	}


	/**
	 * @param items the items to set
	 */
	public void setItems(List<Object> items) {
		this.items = items;
	}


	/**
	 * @return the formula
	 */
	public Map<Object, List<Object>> getFormula() {
		return formula;
	}


	/**
	 * @param formula the formula to set
	 */
	public void setFormula(Map<Object, List<Object>> formula) {
		this.formula = formula;
	}


	/**
	 * @return the tips
	 */
	public List<Object> getTips() {
		return tips;
	}


	/**
	 * @param tips the tips to set
	 */
	public void setTips(List<Object> tips) {
		this.tips = tips;
	}


	/**
	 * @return the dataType
	 */
	public String getDataType() {
		return dataType;
	}


	/**
	 * @param dataType the dataType to set
	 */
	public void setDataType(String dataType) {
		this.dataType = dataType;
	}


	/**
	 * @return the factType
	 */
	public String getFactType() {
		return factType;
	}


	/**
	 * @param factType the factType to set
	 */
	public void setFactType(String factType) {
		this.factType = factType;
	}


	/**
	 * @return the subject
	 */
	public String getSubject() {
		return subject;
	}


	/**
	 * @param subject the subject to set
	 */
	public void setSubject(String subject) {
		this.subject = subject;
	}
	
	
    
}
